#!/bin/sh

ip_current_FILE="$1"
addr="192.168.42."

rm -f $ip_current_FILE
ip=2
while [ $ip != "254" ]
do
    ping  -c 1 -W 1 192.168.42.$ip | grep -q "ttl="&& echo $addr$ip >> $ip_current_FILE&
    ip=`expr "$ip" "+" "1"`
done
